#include "test.hpp"
#include "config.h"

#include "Frame/video.hpp"
#include "Frame/calibration.hpp"
#include "Frame/imageone.hpp"
#include "Frame/imagelist.hpp"

#include "Frame/states.hpp"

#include "Process/core.hpp"

test::test(States *state)
{
	Config1 *param = Config1::Instance();
	Frame *m_frame = 0;
	Process *process = new App(state, param->work_type);
	//std::cout << process->w_type << std::endl;
	
	switch(param->work_type)
	{
		case W_ImageOne:
			m_frame = new imageone(process);
			break;
		case W_ImagePairs:
			break;
		case W_ImageList:
			m_frame = new imagelist(process);
			break;
		case W_Video:
			m_frame = new video(process);
			break;
		case W_Calibration:
			m_frame = new calibration(process);
			break;
		default :
			Log("Wrong Type!",L_ERROR);
			return;
	}

	Log("Created Frame!");
	
	state->RunningFlag = true;
	m_frame->Work();
	
	delete process;
	state->RunningFlag = false;
}
